﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Fundamental.Event
{
    internal class ThreadSafeRaising
    {
        public event EventHandler<EventArgs> MailSender;

        public void OnMailSent()
        {
            EventHandler<EventArgs> temp =
            Interlocked.CompareExchange(ref MailSender, null, null);

            if (temp != null) temp(this, EventArgs.Empty);
        }
    }
}
